Skip to content

Core: Bound IsNull and NotNull on the full field path - #4513

Open
Anurag-S1ngh wants to merge 1 commit into
apache:mainfrom
Anurag-S1ngh:fix/4067-isnull-ancestor-nullability
Open

Anurag-S1ngh wants to merge 1 commit into
apache:mainfrom
Anurag-S1ngh:fix/4067-isnull-ancestor-nullability

Conversation

@Anurag-S1ngh

Copy link
Copy Markdown
Contributor

Rationale for this change

Closes #4067.

IsNull and NotNull folded a required field to AlwaysFalse and AlwaysTrue using only the leaf field's required flag. A required leaf can still be absent when an ancestor struct is null, so a scan could prune every file and return no rows.

The fold now happens at bind time and only when the field and every ancestor on its path to the root are required. BoundIsNull and BoundNotNull no longer fold on direct construction.

Are these changes tested?

Yes. Added coverage for the schema path check, for binding a required leaf under an optional ancestor and a required ancestor, and for direct construction not folding. Also added a scan regression test that appends a null optional struct with a required child and checks that IsNull("s.x") keeps the file and NotNull("s.x") returns no rows.

  • tests/test_schema.py tests/expressions: 965 passed
  • tests/io/test_pyarrow.py -m unit: 267 passed, 1 skipped
  • tests/table/test_init.py -m unit: 184 passed

Are there any user-facing changes?

No API changes. Scans that filter on a required field under an optional ancestor now return the correct rows instead of no rows.

IsNull and NotNull folded a required field to AlwaysFalse and AlwaysTrue using only the leaf field. A required leaf under an optional struct can still be absent, which made plan_files drop matching files. Fold at bind time only when the field and every ancestor are required.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IsNull/NotNull binding ignores ancestor nullability for required nested fields

1 participant